import request from "@/utils/service"
import type * as IInfusion from "./types/index"

/** 获取设备列表信息 */
export function getDeviceListApi(params: IInfusion.IDeviceListParams) {
  return request<IInfusion.InfusionListResponseData<IInfusion.IDeviceListData[]>>({
    url: "/api/v2/lotDevice/getDeviceList",
    method: "get",
    params
  })
}

/** 修改设备 */
export function editDeviceApi(data: IInfusion.IEditDeviceParams) {
  return request<IInfusion.InfusionResponseData<any>>({
    url: "/api/v2/lotDevice/editDevice",
    method: "put",
    data
  })
}

/** 删除设备 */
export function delDeviceApi(data: IInfusion.IDelParams) {
  return request<IInfusion.InfusionResponseData<any>>({
    url: "/api/v2/lotDevice/undoDevice",
    method: "delete",
    data
  })
}

/** 获取离线设备 */
export function getDeviceOfflineApi(params: { device_type_id: number }) {
  return request<IInfusion.InfusionResponseData<IInfusion.IOfflineDevice>>({
    url: "/api/v2/receiver/offlineDevice",
    method: "get",
    params
  })
}

/** 快速匹配保存 */
export function quickDeviceApi(data: IInfusion.IQuickParams) {
  return request<IInfusion.InfusionResponseData<any>>({
    url: "/api/v2/lotDevice/quickConfig",
    method: "post",
    data
  })
}
